package com.zry.autocommit.action;

import com.zry.autocommit.service.GitAutoCommit;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;


@Controller
public class UploadFile {

    final static Logger LOG = LoggerFactory.getLogger(UploadFile.class);
    @Autowired
    private GitAutoCommit jGitAutoCommit;

    @RequestMapping(value = "/upload")
    @ResponseBody
    public String uploadSQLFile(String fileName) {
        try {
            jGitAutoCommit.commitGit(fileName);
            return "success";
        } catch (Exception e) {
            LOG.info("异常：{}", e.getMessage());
        }
        return "false";
    }


}
